package xuruiqi;
import static org.junit.jupiter.api.Assertions.assertEquals;
import java.util.stream.Stream;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;
class PolyTest {
    public static void main(String[] args) {
            static Stream<Arguments> should_generate_polynomials_with_single_term() {
                return Stream.of(
                        Arguments.of(1, 0, "1x^0"),
                        Arguments.of(2, 1, "2x^1"),
                        Arguments.of(3, 2, "3x^2"));
            }
            @ParameterizedTest
            @MethodSource
            void should_generate_polynomials_with_single_term(int coef, int exponent, String expected) {
                Polynomial poly = new Poly(1);
                poly.addTerm(coef, exponent);
                assertEquals(expected, poly.toString());
                assertEquals(exponent, poly.degree());
                assertEquals(1, poly.getTermCount());
            }
            @Test
            void should_generate_polynomials_by_adding_terms_in_ascending_order() {
                Polynomial poly = new Poly(3);
                poly.addTerm(1, 0);
                poly.addTerm(2, 1);
                poly.addTerm(3, 2);
                assertEquals("3x^2 + 2x^1 + 1x^0", poly.toString());
                assertEquals(2, poly.degree());
                assertEquals(3, poly.getTermCount());
            }
            @Test
            void should_generate_polynomials_by_adding_terms_in_descending_order() {
                Polynomial poly = new Poly(3);
                poly.addTerm(3, 2);
                poly.addTerm(2, 1);
                poly.addTerm(1, 0);
                assertEquals("3x^2 + 2x^1 + 1x^0", poly.toString());
                assertEquals(2, poly.degree());
                assertEquals(3, poly.getTermCount());
            }
            @Test
            void should_generate_polynomials_by_adding_terms_in_random_order() {
                Polynomial poly = new Poly(3);
                poly.addTerm(2, 1);
                poly.addTerm(3, 2);
                poly.addTerm(1, 0);
                assertEquals("3x^2 + 2x^1 + 1x^0", poly.toString());
                assertEquals(2, poly.degree());
                assertEquals(3, poly.getTermCount());
            }
            @Test
            void should_create_polynomials_with_vararg_terms() {
                Polynomial poly = new Poly(new Term(2, 1), new Term(3, 2), new Term(1, 0));
                assertEquals("3x^2 + 2x^1 + 1x^0", poly.toString());
                assertEquals(2,
            }
}
}
